﻿using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EntityFrameworkETL.SaveBatchedChanges
{
    public class CommandCache
    {
        public CommandCache()
        {
            ParameterIsFkDictionary = new Dictionary<string, bool>();
        }

        public CommandCache(DbCommand dbCommand)
        {
            DbCommand = dbCommand;
            
        }

        public DbCommand DbCommand { get; set; }
        public long FakeId { get; set; }
        public string TableName { get; set; }
        public string TypeName { get; set; }
        public Type Type { get; set; }
        public object Entity { get; set; }
        public bool HasBeenBatched { get; set; }
        public bool IsFixedUp { get; set; }
        public string PrimaryKeyColumnName { get; set; }
        public string PrimaryKeyPropertyName { get; set; }
        public Dictionary<string, bool> ParameterIsFkDictionary { get; set; } 
        public override string ToString()
        {
            if (!string.IsNullOrEmpty(TypeName))
                return string.Format("{0} {1}", TypeName, FakeId.ToString());
            return base.ToString();
        }
    }
}
